package e

var MsgFlags = map[int]string{
	SUCCESS:             "OK",
	CREATED:             "CREATED",
	ACCEPTED:            "ACCEPTED",
	DELETED:             "DELETED",
	BAD_REQUEST:         "BAD REQUEST",
	UNAUTHORIZED:        "UNAUTHORIZED",
	FORBIDDEN:           "FORBIDDEN",
	NOT_FOUND:           "NOT FOUND",
	UNPROCESABLE_ENTITY: "UNPROCESABLE ENTITY",
	ERROR:               "INTERNAL SERVER ERROR",
	//请求相关的状态码
	PATH_PARAMS: "路径参数错误",
	GET_PARAMS:  "GET参数错误",
	JSON_PARAMS: "JSON参赛错误",
	//解析相关的状态码
	JSON_ENCODE:  "JSON编译错误",
	JSON_DECODE:  "JSON解析错误",
	DATA_ENCRYPT: "数据加密错误",
	DATA_DECRYPT: "数据解密错误",
	//验证相关的状态码
	CAPTCHA_VERIFY: "验证码错误",
	TOKEN_VERIFY:   "TOKEN验证错误",
	SIGN_VERIFY:    "签名验证错误",
	USER_OR_PASS:   "用户名或者密码错误",
	//返回相关的状态码
	ALREADY_EXIST: "已存在该资源",
	NOT_EXIST:     "该资源不存在",
	ADD_FAIL:      "添加资源失败",
	UPDATE_FAIL:   "更新资源失败",
	DELETE_FAIL:   "删除资源失败",
	//资源相关的状态码
	TOKEN_GEN:   "Token生成失败",
	CAPTCHA_GEN: "验证码生成失败",
	INTERNAL:    "内部错误",
}

func GetMsg(code int) string {
	msg, ok := MsgFlags[code]
	if ok {
		return msg
	}

	return MsgFlags[ERROR]
}
